import { createRouter, createWebHashHistory } from "vue-router";
import Channels from "@/view/Channels";

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      redirect: "/login",
    },
    {
      path: "/login",
      name: "Login",
      component: () => import("../view/Login"),
    },
    {
      path: "/register",
      name: "Register",
      component: () => import("../view/Register"),
    },
    {
      path: "/channels",
      name: "channels",
      component: Channels,
      children: [
        {
          path: "/channels/@me",
          component: () => import("../components/channels/@me"),
          children: [
            {
              path: "/channels/@me/my_friend",
              component: () => import("../components/channels/MyFriend"),
            },
            {
              path: "/channels/@me/:sessionId",
              component: () => import("../components/channels/Session"),
            },
          ],
        },
        {
          path: "/guild-discovery",
          component: () => import("../view/GuildDiscovery"),
        },
        {
          path: "/channels/:serverId",
          component: () => import("../components/channels/SessionList"),
          children: [
            {
              path: "/channels/:serverId/:sessionId",
              component: () => import("../components/channels/Session"),
            },
          ],
        },
      ],
    },
  ],
});

export default router;
